﻿@{
    ViewBag.Title = "Role Add To User";
    Layout = "~/Views/Shared/_Layout.cshtml";
}

<div class="spacerBody">
    <h2>Role Add to User</h2>
    
    @Html.ActionLink("Delete Role For User", "DeleteRoleForUser") | @Html.ActionLink("Roles Listing", "Index")
    
    @using (Html.BeginForm("RoleAddToUser", "Admin"))
    {
        @Html.AntiForgeryToken()
        @Html.ValidationSummary(true)

        <div class="message-success">@ViewBag.ResultMessage</div>
        <p>
            Username : @Html.TextBox("UserName")
            Role Name: @Html.DropDownList("RoleName", ViewBag.Roles as SelectList)

        </p>

        <input type="submit" value="Save" />
    }
    <div class="hr"></div>
    @using (Html.BeginForm("GetRoles", "Admin"))
    {
        @Html.AntiForgeryToken()
        <p>
            Username : @Html.TextBox("UserName")
            <input type="submit" value="Get Roles for this User" />
        </p>
    }

    @if (ViewBag.RolesForThisUser != null)
    {
        <text>
            <h3>Roles for this user </h3>
            <ol>
                @foreach (string s in ViewBag.RolesForThisUser)
                {
                    <li>@s</li>
                }
            </ol>
        </text>
    }
</div>